package com.ds.infrastructure.hyperspace.common.flow;

import com.ds.infrastructure.hyperspace.common.EndpointNode;

import java.util.Map;

/**
 * @author  Weishaoying
 */
public interface FlowHandlerPipeline<C extends DuplexFlowContext> {

    /**
     * Get refer target endpoint service name
     * @return
     */
    String getTargetServiceName();

    /**
     * Register the pipeline host
     * @param hostName
     */
    void registerPipelineHost(String hostName);

    /**
     * Response the request from post handler
     * @param duplexFlowContext
     * @param data
     */
    void handleOutput(C duplexFlowContext, Object data);

    /**
     * Select a target node
     * @param duplexFlowContext
     * @param nodeContextMap
     * @return
     */
    EndpointNode selectNode(C duplexFlowContext, Map<String, ? extends TargetNodeWrapper> nodeContextMap);

}
